package com.tencent.wxcloudrun.controller;

import com.alibaba.fastjson2.JSONObject;
import com.tencent.wxcloudrun.config.ApiResponse;
import com.tencent.wxcloudrun.model.TWarningMsgLog;
import com.tencent.wxcloudrun.service.TWarningMsgLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/warn")
public class WarningController {

    @Autowired
    private TWarningMsgLogService warningMsgLogService;
    final Logger logger = LoggerFactory.getLogger(WarningController.class);

    @PostMapping(value = "/list")
    ApiResponse getInfoList(@RequestBody JSONObject param) {
//        logger.info("/api/count get request");
        logger.info(param.toString());
        List<TWarningMsgLog> list= warningMsgLogService.findAll(param);
//        Integer count = 0;
//        if (counter.isPresent()) {
//            count = counter.get().getCount();
//        }

        return ApiResponse.ok(list);
    }
}
